home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / Aliases.h < prev    next >
Text File  |  1995-07-06  |  6KB  |  162 lines

  1. /*
  2.      File:        Aliases.h
  3.  
  4.      Contains:    Alias Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __ALIASES__
  21. #define __ALIASES__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __APPLETALK__
  30. #include <AppleTalk.h>
  31. #endif
  32. /*    #include <OSUtils.h>                                        */
  33. /*        #include <MixedMode.h>                                    */
  34. /*        #include <Memory.h>                                        */
  35.  
  36. #ifndef __FILES__
  37. #include <Files.h>
  38. #endif
  39. /*    #include <Finder.h>                                            */
  40.  
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44.  
  45. #if PRAGMA_ALIGN_SUPPORTED
  46. #pragma options align=mac68k
  47. #endif
  48.  
  49. #if PRAGMA_IMPORT_SUPPORTED
  50. #pragma import on
  51. #endif
  52.  
  53.  
  54. enum {
  55.     rAliasType                    = 'alis',                        /* Aliases are stored as resources of this type */
  56. /* define alias resolution action rules mask */
  57.     kARMMountVol                = 0x00000001,                    /* mount the volume automatically */
  58.     kARMNoUI                    = 0x00000002,                    /* no user interface allowed during resolution */
  59.     kARMMultVols                = 0x00000008,                    /* search on multiple volumes */
  60.     kARMSearch                    = 0x00000100,                    /* search quickly */
  61.     kARMSearchMore                = 0x00000200,                    /* search further */
  62.     kARMSearchRelFirst            = 0x00000400,                    /* search target on a relative path first */
  63. /* define alias record information types */
  64.     asiZoneName                    = -3,                            /* get zone name */
  65.     asiServerName                = -2,                            /* get server name */
  66.     asiVolumeName                = -1,                            /* get volume name */
  67.     asiAliasName                = 0,                            /* get aliased file/folder/volume name */
  68.     asiParentName                = 1                                /* get parent folder name */
  69. };
  70.  
  71. /* define the alias record that will be the blackbox for the caller */
  72. struct AliasRecord {
  73.     OSType                            userType;                    /* appl stored type like creator type */
  74.     unsigned short                    aliasSize;                    /* alias record size in bytes, for appl usage */
  75. };
  76. typedef struct AliasRecord AliasRecord;
  77.  
  78. typedef AliasRecord *AliasPtr, **AliasHandle;
  79.  
  80. /* alias record information type */
  81. typedef short AliasInfoType;
  82.  
  83. typedef pascal Boolean (*AliasFilterProcPtr)(CInfoPBPtr cpbPtr, Boolean *quitFlag, Ptr myDataPtr);
  84.  
  85. #if GENERATINGCFM
  86. typedef UniversalProcPtr AliasFilterUPP;
  87. #else
  88. typedef AliasFilterProcPtr AliasFilterUPP;
  89. #endif
  90.  
  91. enum {
  92.     uppAliasFilterProcInfo = kPascalStackBased
  93.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  94.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(CInfoPBPtr)))
  95.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean*)))
  96.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Ptr)))
  97. };
  98.  
  99. #if GENERATINGCFM
  100. #define NewAliasFilterProc(userRoutine)        \
  101.         (AliasFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAliasFilterProcInfo, GetCurrentArchitecture())
  102. #else
  103. #define NewAliasFilterProc(userRoutine)        \
  104.         ((AliasFilterUPP) (userRoutine))
  105. #endif
  106.  
  107. #if GENERATINGCFM
  108. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr)        \
  109.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAliasFilterProcInfo, (cpbPtr), (quitFlag), (myDataPtr))
  110. #else
  111. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr)        \
  112.         (*(userRoutine))((cpbPtr), (quitFlag), (myDataPtr))
  113. #endif
  114.  
  115. extern pascal OSErr NewAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle *alias)
  116.  TWOWORDINLINE(0x7002, 0xA823);
  117. /* create a minimal new alias for a target and return alias record handle */
  118. extern pascal OSErr NewAliasMinimal(const FSSpec *target, AliasHandle *alias)
  119.  TWOWORDINLINE(0x7008, 0xA823);
  120. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  121. extern pascal OSErr NewAliasMinimalFromFullPath(short fullPathLength, const void *fullPath, ConstStr32Param zoneName, ConstStr31Param serverName, AliasHandle *alias)
  122.  TWOWORDINLINE(0x7009, 0xA823);
  123. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  124. extern pascal OSErr ResolveAlias(ConstFSSpecPtr fromFile, AliasHandle alias, FSSpec *target, Boolean *wasChanged)
  125.  TWOWORDINLINE(0x7003, 0xA823);
  126. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  127. extern pascal OSErr GetAliasInfo(AliasHandle alias, AliasInfoType index, Str63 theString)
  128.  TWOWORDINLINE(0x7007, 0xA823);
  129. /* 
  130.   Given a file spec, return target file spec if input file spec is an alias.
  131.   It resolves the entire alias chain or one step of the chain.  It returns
  132.   info about whether the target is a folder or file; and whether the input
  133.   file spec was an alias or not. 
  134. */
  135. extern pascal OSErr ResolveAliasFile(FSSpec *theSpec, Boolean resolveAliasChains, Boolean *targetIsFolder, Boolean *wasAliased)
  136.  TWOWORDINLINE(0x700C, 0xA823);
  137. extern pascal OSErr FollowFinderAlias(ConstFSSpecPtr fromFile, AliasHandle alias, Boolean logon, FSSpec *target, Boolean *wasChanged)
  138.  TWOWORDINLINE(0x700F, 0xA823);
  139. /* 
  140.    Low Level Routines 
  141.  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  142. */
  143. extern pascal OSErr MatchAlias(ConstFSSpecPtr fromFile, unsigned long rulesMask, AliasHandle alias, short *aliasCount, FSSpecArrayPtr aliasList, Boolean *needsUpdate, AliasFilterUPP aliasFilter, void *yourDataPtr)
  144.  TWOWORDINLINE(0x7005, 0xA823);
  145. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  146. extern pascal OSErr UpdateAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle alias, Boolean *wasChanged)
  147.  TWOWORDINLINE(0x7006, 0xA823);
  148.  
  149. #if PRAGMA_IMPORT_SUPPORTED
  150. #pragma import off
  151. #endif
  152.  
  153. #if PRAGMA_ALIGN_SUPPORTED
  154. #pragma options align=reset
  155. #endif
  156.  
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160.  
  161. #endif /* __ALIASES__ */
  162.